<% if @roles.length == 0 then %>
  <p>Não existe nenhuma regra registrada.</p>
<% else %>
  <table border="1">
  <thead>
      <tr>
        <td>Nome</td>
        <td>Capacidades</td>
        <td>&nbsp;</td>
      </tr>
  </thead>
  <tbody>
      <% for role in @roles %>
      <tr onmouseover="this.style.background='#DFDFFF'" onmouseout="this.style.background=''">
        <td><%=role[:name]%></td>
        <td>
            <div class="list_values">
                <% for capabilite in role.capabilites%>
                  <%=capabilite[:acronym]%>:<%=capabilite[:name]%><br/>
                <% end %>
            </div>
        </td>
        <td style="width:55px">
              <%=link_to_remote( 
                        image_tag("/images/icons/alter.gif", :title => "alterar", :border => "0" ), 
                        :url => { :action => "role_form", :id => role[:id], :act => "role_alter" }, 
                        :loading => "TrackSuite.ajax.loadding('role_list_action_#{role[:id]}');",
                        :loaded => "TrackSuite.ajax.loaded.clear('role_list_action_#{role[:id]}');"
              )%>
              <%=link_to_remote( 
                        image_tag("/images/icons/remove.gif", :title => "remover", :border => "0" ), 
                        :url => { :action => "role_remove", :id => role[:id] }, 
                        :loading => "TrackSuite.ajax.loadding('role_list_action_#{role[:id]}');",
                        :loaded => "TrackSuite.ajax.loaded.clear('role_list_action_#{role[:id]}');",
                        :confirm => "Atenção, deseja remover a regra #{role[:name]}."
              )%>
              <span id="role_list_action_<%=role[:id]%>">&nbsp;</span>
          </td>
      </tr>
      <% end %>
  </tbody>
  <tfoot>
      <tr>
          <td colspan="4" align="right">&nbsp;<%= will_paginate @roles, {:ajax => ajax} %></td>
      </tr>
  </tfoot>
  </table>
<% end %>